package jmind.core.selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.safari.SafariDriver;


/**
 * description: 临床试验用药
 * http://www.chinadrugtrials.org.cn/clinicaltrials.searchlist.dhtml
 * <p>
 * http://www.chinadrugtrials.org.cn/clinicaltrials.searchlistdetail.dhtml
 *
 *
 * selenium  自动化测试模拟浏览器
 * https://blog.csdn.net/qq_22003641/article/details/79137327
 *
 * firefox驱动
 * https://npm.taobao.org/mirrors/geckodriver/v0.29.0/
 * chrome驱动
 * https://npm.taobao.org/mirrors/chromedriver
 *
 * http://selenium-release.storage.googleapis.com/index.html
 * https://www.cnblogs.com/meiling-ji/p/5283476.html
 *   mac 启动 SafariDriver
 *   https://blog.csdn.net/zczy01234/article/details/85792410
 *   需要在Safari工具栏的“开发”中，勾选“允许远程自动化”；
 *
 *  js抓取工具  webster
 *  https://github.com/zhuyingda/webster?spm=ata.13261165.0.0.34b3537frFRCKC
 * @author weibo.xie
 * @date : create in 2:33 下午 2021/1/15
 */
public class MyWebDriver {
    public static void main(String[] args) {
        //  System.setProperty("webdriver.firefox.bin","C:\\Program Files\\Mozilla Firefox\\firefox.exe");
        //加载驱动
        //   System.setProperty("webdriver.firefox.marionette","geckodriver.exe");
        //  System.setProperty("webdriver.chrome.driver", "/usr/local/Caskroom/chromedriver/87.0.4280.88/chromedriver");
        // System.setProperty("webdriver.ie.driver","IEDriverServer.exe")
       System.setProperty("webdriver.safari.driver", "/Users/weibo/library/safari/extensions");
       System.setProperty("webdriver.safari.noinstall", "true");

        WebDriver driver = new SafariDriver();

        driver.get("https://item.jd.com/68445478560.html");

        String title = driver.getTitle();
        WebElement body = driver.findElement(By.tagName("body"));

        System.err.println("title="+title);
        System.err.println("-------------------");
        System.err.println(driver.getPageSource());
     driver.quit();

    }


}